enocean5 2.2.0
Loading...
Searching...
No Matches
EnOcean 5 Click Driver

API for configuring and manipulating EnOcean 5 Click driver. More...

Topics

 EnOcean 5 Device Settings
 Settings of EnOcean 5 Click driver.
 EnOcean 5 MikroBUS Map
 MikroBUS pin mapping of EnOcean 5 Click driver.

Functions

void enocean5_cfg_setup (enocean5_cfg_t *cfg)
 EnOcean 5 configuration object setup function.
err_t enocean5_init (enocean5_t *ctx, enocean5_cfg_t *cfg)
 EnOcean 5 initialization function.
err_t enocean5_generic_write (enocean5_t *ctx, uint8_t *data_in, uint16_t len)
 EnOcean 5 data writing function.
err_t enocean5_generic_read (enocean5_t *ctx, uint8_t *data_out, uint16_t len)
 EnOcean 5 data reading function.
void enocean5_set_rst_pin (enocean5_t *ctx, uint8_t state)
 EnOcean 5 set RST pin function.
err_t enocean5_reset_device (enocean5_t *ctx)
 EnOcean 5 reset device function.
err_t enocean5_send_packet (enocean5_t *ctx)
 EnOcean 5 send packet function.
err_t enocean5_read_packet (enocean5_t *ctx)
 EnOcean 5 read packet function.
err_t enocean5_wait_packet (enocean5_t *ctx, uint8_t type, uint8_t cmd, uint8_t max_time_s)
 EnOcean 5 wait packet function.
void enocean5_clear_buffers (enocean5_t *ctx)
 EnOcean 5 clear buffers function.
err_t enocean5_read_info (enocean5_t *ctx)
 EnOcean 5 read info function.
err_t enocean5_send_radio_message (enocean5_t *ctx, uint8_t rorg, uint8_t *data_in, uint8_t data_len)
 EnOcean 5 send radio message function.

Detailed Description

API for configuring and manipulating EnOcean 5 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ enocean5_cfg_setup()

void enocean5_cfg_setup ( enocean5_cfg_t * cfg)

EnOcean 5 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See enocean5_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ enocean5_clear_buffers()

void enocean5_clear_buffers ( enocean5_t * ctx)

EnOcean 5 clear buffers function.

This function clears the ring buffers and the RX packet object.

Parameters
[in]ctx: Click context object. See enocean5_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ enocean5_generic_read()

err_t enocean5_generic_read ( enocean5_t * ctx,
uint8_t * data_out,
uint16_t len )

EnOcean 5 data reading function.

This function reads a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See enocean5_t object definition for detailed explanation.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • >0 - Number of data bytes read,
  • <=0 - Error/Empty Ring buffer. See #err_t definition for detailed explanation.
Note
None.

◆ enocean5_generic_write()

err_t enocean5_generic_write ( enocean5_t * ctx,
uint8_t * data_in,
uint16_t len )

EnOcean 5 data writing function.

This function writes a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See enocean5_t object definition for detailed explanation.
[in]data_in: Data buffer for sending.
[in]len: Number of bytes for sending.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ enocean5_init()

err_t enocean5_init ( enocean5_t * ctx,
enocean5_cfg_t * cfg )

EnOcean 5 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See enocean5_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See enocean5_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ enocean5_read_info()

err_t enocean5_read_info ( enocean5_t * ctx)

EnOcean 5 read info function.

This function reads the device information and stores it in the Click context object.

Parameters
[in]ctx: Click context object. See enocean5_t object definition for detailed explanation.
Returns
  • 0 - Correct packet received,
  • -1 - Error,
  • >0 - Response error, see ENOCEAN5_RET_x macros. See #err_t definition for detailed explanation.
Note
None.

◆ enocean5_read_packet()

err_t enocean5_read_packet ( enocean5_t * ctx)

EnOcean 5 read packet function.

This function reads RX packet from the ring buffer and stores it in the Click context object. It waits up to 1 second for a packet, and if there's no packet received it returns an error.

Parameters
[in]ctx: Click context object. See enocean5_t object definition for detailed explanation.
Returns
  • 0 - Correct packet received,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ enocean5_reset_device()

err_t enocean5_reset_device ( enocean5_t * ctx)

EnOcean 5 reset device function.

This function resets the device by toggling the reset pin logic state.

Parameters
[in]ctx: Click context object. See enocean5_t object definition for detailed explanation.
Returns
  • 0 - Correct packet received,
  • -1 - Error.
Note
None.

◆ enocean5_send_packet()

err_t enocean5_send_packet ( enocean5_t * ctx)

EnOcean 5 send packet function.

This function sends TX packet from the Click context object.

Parameters
[in]ctx: Click context object. See enocean5_t object definition for detailed explanation.
Returns
  • 0 - Packet is sent,
  • -1 - Packet error.
Note
None.

◆ enocean5_send_radio_message()

err_t enocean5_send_radio_message ( enocean5_t * ctx,
uint8_t rorg,
uint8_t * data_in,
uint8_t data_len )

EnOcean 5 send radio message function.

This function forms and sends the radio message telegram.

Parameters
[in]ctx: Click context object. See enocean5_t object definition for detailed explanation.
[in]rorg: Telegram type.
[in]data_in: Data content.
[in]data_len: Number of data bytes (up to 14).
Returns
  • 0 - Packet is sent,
  • -1 - Packet error. See #err_t definition for detailed explanation.
Note
None.

◆ enocean5_set_rst_pin()

void enocean5_set_rst_pin ( enocean5_t * ctx,
uint8_t state )

EnOcean 5 set RST pin function.

This function sets the RESET pin logic state.

Parameters
[in]ctx: Click context object. See enocean5_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ enocean5_wait_packet()

err_t enocean5_wait_packet ( enocean5_t * ctx,
uint8_t type,
uint8_t cmd,
uint8_t max_time_s )

EnOcean 5 wait packet function.

This function waits for the desired RX packet to arrive and stores it in the Click context object.

Parameters
[in]ctx: Click context object. See enocean5_t object definition for detailed explanation.
[in]type: Expected packet type byte.
[in]cmd: Expected packet code byte.
[in]max_time_s: Maximum wait time in seconds.
Returns
  • 0 - Correct packet received,
  • -1 - Error,
  • >0 - Response error, see ENOCEAN5_RET_x macros.
Note
None.